<template>
  <svg aria-hidden="true" :style="iconStyle">
    <use :xlink:href="symbolId" :fill="color" />
  </svg>
</template>

<script lang="ts" setup>
import { computed, CSSProperties } from "vue"

interface SvgProps {
  name: string
  prefix?: string
  iconStyle?: CSSProperties
  color?: string
}

const props = withDefaults(defineProps<SvgProps>(), {
  prefix: "icon",
  color: "#888888",
  iconStyle: () => ({ width: "22px", height: "22px", color: "#888888" })
})

const symbolId = computed(() => `#${props.prefix}-${props.name}`)
</script>
